{% extends 'frame-exam.html' %}
{% block title %}Acdp Exam{% endblock %}
{% block main %}Acdp Exam System{% endblock %}

{% block body %}

<div class="mdui-container mdui-m-y-5 mdui-hidden-xs">
    <div class="mdui-container">
        <div id='card1' class="mdui-card" style="width: 100%; min-height: 300px;">
            <iframe id="exam1" src="/exam/test" style="width: 100%;" onload="Javascript:SetCwinHeight('1')" scrolling="no" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes">
            </iframe>
        </div>
    </div>
</div>

<div class="mdui-container mdui-m-y-5 mdui-hidden-sm-up">
    <div id='card2' class="mdui-card" style="width: 100%; min-height: 300px;">
        <iframe id="exam2" src="/exam/paper" style="width: 100%;" onload="Javascript:SetCwinHeight('2')" scrolling="no" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes">
        </iframe>
    </div>
</div>

<script>
    function SetCwinHeight(ex='1'){
        var iframeid=document.getElementById("exam"+ex);
        var card=document.getElementById("card"+ex);
        var hei = 0;
        if (document.getElementById){
            if (iframeid && !window.opera){
                if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight){
                    hei = iframeid.contentDocument.body.offsetHeight;
                }else if(iframeid.Document && iframeid.Document.body.scrollHeight){
                    hei = iframeid.Document.body.scrollHeight;
                }
            }
            hei = hei + 40;
            iframeid.height = hei;
            card.height = hei;
        }
    }
    SetCwinHeight();
    window.onresize = SetCwinHeight;
    </script>
{% endblock %}